package com.kuding.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.kuding.props.aliyun.AliyunSTSProperty;
import com.kuding.sts.AliyunStsComponent;

@Configuration
@ConditionalOnProperty(name = "sys.enable-aliyun-sts", havingValue = "true")
@EnableConfigurationProperties({ AliyunSTSProperty.class })
public class AliyunStsComponentConfig {

	@Autowired
	private AliyunSTSProperty aliyunSTSProperty;

	@Bean
	public AliyunStsComponent stsComponent() {
		AliyunStsComponent stsComponent = new AliyunStsComponent(aliyunSTSProperty);
		return stsComponent;
	}
}
